var xiuUserID = document.getElementById('xiufanxianbao').src.split('?')[1];
function closeDiv(str) {
	var obj = document.getElementById(str);
	if (obj) obj.parentNode.removeChild(obj);
	var obj = document.getElementById('xiufanxianbao');
	if (obj) obj.parentNode.removeChild(obj);
}
function colseTips() {
	document.getElementById('closeTips').style.display="block";
}
function writeDocument(strIframe) {
	var obj = document.getElementById('xiuWin');
	if (obj) obj.parentNode.removeChild(obj);
	var xiuWin=document.createElement('div');
	xiuWin.id = 'xiuWin';
	xiuWin.style.zIndex = 10000;
	xiuWin.style.position = 'absolute';
	xiuWin.style.display = "block";
	xiuWin.style.left = "50%";
	xiuWin.style.top = "50%";
	xiuWin.style.marginLeft = "-356px";
	xiuWin.style.marginTop = (doc.scrollTop-231)+"px";
	document.body.appendChild(xiuWin);
	var strHtml = "<div style=\"width:712px;border:6px solid #c2c2c2;background:#fff;height:462px;\"><div style=\"background:#b10000;height:30px;color:#fff;font-size:14px;font-weight:bold;text-indent:3px;\"><em style=\"float:right; margin-right:10px; margin-top:8px;width:16px;height:14px;display:block;cursor:pointer;background:url(images/bao_gif.gif) no-repeat;\" title=\"关闭，无法拿返利！\" onclick=\"closeDiv('xiuWin')\" onmouseover=\"colseTips()\"></em><span id=\"closeTips\" style=\"float:right;width:125px;height:30px;line-height:30px;font-size:12px;display:none\">关闭将无法拿返利-></span><span style=\"width:525px;height:30px;line-height:30px;display:block;\">返现宝0528</span></div><div style=\"margin:5px;height:400px;\"><iframe src='"+strIframe+"' id='iframeFan' name='iframeFan' width=700 height=400 frameborder=0 scrolling=auto></iframe></div><div style=\"text-align:right;margin-right:5px;font-size:14px;font-weight:bold;\"><a href=\"javascript:;\" title=\"关闭，无法拿返利！\" onclick=\"closeDiv('xiuWin')\" onmouseover=\"colseTips()\">关闭</a></div></div>";
	document.getElementById("xiuWin").innerHTML=strHtml;
}
var doc = (document.compatMode!="BackCompat")?document.documentElement:document.body;
if (document.selection) xiuKeyText = document.selection.createRange().text;
else if (window.getSelection) xiuKeyText = window.getSelection();
else if (document.getSelection) xiuKeyText = document.getSelection();
xiuStrUrl = document.URL;
if (xiuKeyText=="" && xiuStrUrl.indexOf("taobao.com")>=0) {
	xiuKeyText = document.getElementsByTagName("title")[0].innerHTML.split("-淘宝网")[0];//@
}
if (xiuKeyText == "" && xiuStrUrl.indexOf("tmall.com") >= 0) {
    xiuKeyText = document.getElementsByTagName("title")[0].innerHTML.split("-淘宝商城")[0];
}
if (document.getElementsByName('item_id_num').length > 0) {
    xiuNumId = document.getElementsByName('item_id_num')[0].value.substring(0, 11);
    writeDocument("http://localhost/duoduo/dd20120528/fanxianbao/fanxianbao.php?u="+encodeURI(xiuUserID)+"&id="+xiuNumId+"&qkey="+encodeURI(xiuKeyText));
} else alert('此商品已下架或不是商品页');
